﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace bridge.Views
{
    public class Ratings
    {
        private string songID;
        public string SongID
        {
            get { return songID; }
            set { songID = value; }
        }

        private int fiveStars;
        public int FiveStars
        {
            get { return fiveStars; }
            set { fiveStars = value; }
        }

        private int fourStars;
        public int FourStars
        {
            get { return fourStars; }
            set { fourStars = value; }
        }
        private int threeStars;
        public int ThreeStars
        {
            get { return threeStars; }
            set { threeStars = value; }
        }

        private int twoStars;
        public int TwoStars
        {
            get { return twoStars; }
            set { twoStars = value; }
        }

        private int oneStars;
        public int OneStars
        {
            get { return oneStars; }
            set { oneStars = value; }
        }

        private int totalStars;
        public int TotalStars
        {
            get { calculate(); return totalStars ; }
            set { calculate(); }
        }

        private float averageStars;
        public float AverageStars
        {
            get { calculate(); return averageStars; }
            set { calculate(); }
        }

        private void calculate(){
            totalStars = (oneStars + twoStars + threeStars + fourStars + fiveStars); 
           
            averageStars = (oneStars + 2 * twoStars + 3 * threeStars + 4 * fourStars + 5 * fiveStars) / totalStars; 
        }

    }
}